package cn.ffcs.uec.common.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import cn.ffcs.uec.common.dao.UecBdPsnclDao;
import cn.ffcs.uec.common.vo.UecBdPsncl;
import cn.ffcs.uom.common.dao.BaseDaoImpl;
import cn.ffcs.uom.common.util.StrUtil;

@Repository("uecBdPsnclDao")
@Transactional
public class UecBdPsnclDaoImpl extends BaseDaoImpl implements UecBdPsnclDao {

	@Override
	public List<UecBdPsncl> qryUecBdPsnclByPid(UecBdPsncl uecBdPsncl) {
		StringBuilder sb = new StringBuilder(
				" SELECT * FROM UEC_BD_PSNCL T  WHERE 1=1 ");
		List<Object> params = new ArrayList<Object>();
		sb.append(" AND T.ENABLESTATE = '2' ");
		if (uecBdPsncl != null) {
			if (!StrUtil.isNullOrEmpty(uecBdPsncl.getParentId())) {
				sb.append(" AND T.PARENT_ID = ? ");
				params.add(uecBdPsncl.getPkPsncl());
			}
			List<UecBdPsncl> list = super.jdbcFindList(sb.toString(),
					params, UecBdPsncl.class);
			return list;
		}
		return null;
	}


}
